package com.wxltsoft.dataobjects;

public class DrwSquareDO {
	
	protected Integer id;
	
	protected String square;
	
	protected Integer width;
	
	protected Integer height;
	
	protected Integer direction;

	protected String directionName;
	
	protected Integer pointX;
	
	protected Integer pointY;
	
	protected Integer pdfBarcodeX;
	
	protected Integer pdfBarcodeY;
	
	protected Integer realWidth;
	
	protected Integer realHeight;
	
	public final static float CONVERT_PROPORTION = 2.834f;
	
	public final static int DEFAULT_X = 160;
	
	public final static int DEFAULT_Y = 20;

	public DrwSquareDO() {}
	
	public DrwSquareDO(Integer id , String square , Integer direction) {
		this.id = id;
		this.square = square;
		this.direction = direction;
	}
	
	public DrwSquareDO(Integer id , String square , Integer width , Integer height , 
			Integer direction , Integer pointX , Integer pointY) {
		this.id = id;
		this.square = square;
		this.width = width;
		this.height = height;
		this.direction = direction;
		this.pointX = pointX;
		this.pointY = pointY;
		resetRealRact();
	}
	
	public void resetRealRact() {
		if(width != null) this.realWidth = (int)Math.round(((float)width/CONVERT_PROPORTION));
		if(height != null) this.realHeight = (int)Math.round((float)height/CONVERT_PROPORTION);
	}
	
	public Integer getPdfBarcodeX() {
		return pdfBarcodeX == null ? this.pointX : this.pdfBarcodeX;
	}

	public void setPdfBarcodeX(Integer pdfBarcodeX) {
		this.pdfBarcodeX = pdfBarcodeX;
	}

	public Integer getPdfBarcodeY() {
		return pdfBarcodeY == null ? this.pointY : this.pdfBarcodeY;
	}

	public void setPdfBarcodeY(Integer pdfBarcodeY) {
		this.pdfBarcodeY = pdfBarcodeY;
	}
	
	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getSquare() {
		return square;
	}

	public void setSquare(String square) {
		this.square = square;
	}

	public Integer getWidth() {
		return width;
	}

	public void setWidth(Integer width) {
		this.width = width;
	}

	public Integer getHeight() {
		return height;
	}

	public void setHeight(Integer height) {
		this.height = height;
	}

	public Integer getDirection() {
		return direction;
	}

	public void setDirection(Integer direction) {
		this.direction = direction;
	}

	public String getDirectionName() {
		return directionName;
	}

	public void setDirectionName(String directtionName) {
		this.directionName = directtionName;
	}

	public Integer getPointX() {
		return pointX;
	}

	public void setPointX(Integer pointX) {
		this.pointX = pointX;
	}

	public Integer getPointY() {
		return pointY;
	}

	public Integer getRealWidth() {
		return realWidth;
	}

	public void setRealWidth(Integer realWidth) {
		this.realWidth = realWidth;
	}

	public Integer getRealHeight() {
		return realHeight;
	}

	public void setRealHeight(Integer realHeight) {
		this.realHeight = realHeight;
	}

	public void setPointY(Integer pointY) {
		this.pointY = pointY;
	}

}
